<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
	#hd{
		width: 200px;
		height: 200px;
		background: green;
	}
</style>
<script type="text/javascript">
	window.onload = function(){
		var hd = document.getElementById('hd');
		// 设置定时器用来控制运动的效果
		var a = 1;

		var timer = setInterval(function(){
			var old_width = parseInt(hd.style.width);//获得现在的宽度
			var new_width = old_width+5*a;//计算新值
			hd.style.width = new_width+'px';//将新值赋值回去
			hd.style.height = new_width+'px';

			if(new_width==400){
				// alert('该变小了！');
				a=-1;
			}
			if(new_width==200){//当div到200之后，就停掉
				clearInterval(timer);
			}
		},40)
	}
</script>
</head>

<body>

<div id="hd" style="width:200px;">
	后盾网
</div>


</body>
</html>
